<template>
  <div>
    <div>
      <table class="bs-table">
        <tr class="bs-table_row">
          <th class="bs-table_th" style="width: 200px">规划名称</th>
          <td class="bs-table_td" colspan="3">
            <el-link style="font-weight: bold;font-size: 20px" href="javascript:;" target="_blank">
              {{registerinfoData.title}}
            </el-link>
            <span style="vertical-align: bottom">【{{registerinfoData.year}}】</span>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th" style="width: 200px">规划类型</th>
          <td class="bs-table_td">{{BASICINFO.category[registerinfoData.category]}}</td>
          <th class="bs-table_th" style="width: 200px">规划期限</th>
          <td class="bs-table_td">{{registerinfoData.startDate}}至{{registerinfoData.endDate}}</td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">申报(牵头)单位</th>
          <td class="bs-table_td">{{registerinfoData.unitName}}{{registerinfoData.deptName}}</td>
          <th class="bs-table_th">协同编制部门</th>
          <td class="bs-table_td">
            <span v-if="registerinfoData.supportDeptNameList">
              {{registerinfoData.supportDeptNameList.join(",")}}
            </span>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">发布时间</th>
          <td class="bs-table_td">{{registerinfoData.releaseDate }}</td>
          <th class="bs-table_th">发布层级</th>
          <td class="bs-table_td">{{BASICINFO.planningLevel[registerinfoData.planningLevel]}}</td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">审批机关级别</th>
          <td class="bs-table_td">{{BASICINFO.approvingAuthorityLevel[registerinfoData.approvingAuthorityLevel]}}</td>
          <th class="bs-table_th">审批机关性质</th>
          <td class="bs-table_td">{{BASICINFO.approvingAuthorityNature[registerinfoData.approvingAuthorityNature]}}</td>
        </tr>
        <tr class="bs-table_row" v-if="registerinfoData.planningRank">
          <th class="bs-table_th">规划等级</th>
          <td class="bs-table_td">{{BASICINFO.planningRank[registerinfoData.planningRank]}}</td>
          <th class="bs-table_th"></th>
          <td class="bs-table_td"></td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">联系人姓名</th>
          <td class="bs-table_td">{{registerinfoData.contactName}}</td>
          <th class="bs-table_th">联系电话</th>
          <td class="bs-table_td">{{registerinfoData.contactNumber}}</td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">编制经费来源</th>
          <td class="bs-table_td" colspan="3" v-html="registerinfoData.financialSource">
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">立项依据</th>
          <td class="bs-table_td" colspan="3">
            <span v-html="registerinfoData.basis"></span>
            <span>
              <div v-if="registerinfoData.basisFileId">
                <span style="font-weight: bold;font-size: 14px;float:left;margin-top: 14px">依据材料:</span>
                <preview :attachementId="Number(registerinfoData.basisFileId)" v-if="registerinfoData.basisFileId"></preview>
               </div>
            </span>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">主要内容</th>
          <td class="bs-table_td" colspan="3" v-html="registerinfoData.content">
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th">相关材料</th>
          <td class="bs-table_td" colspan="3">
            <div v-for="fileid in registerinfoData.relatedFiles" :key="fileid">
              <preview :attachementId="Number(fileid)" v-if="fileid"></preview>
            </div>
          </td>
        </tr>
      </table>
    </div>
  </div>
</template>
<script>
  import {getRegisterinfo} from "@/api/registerinfo/registerinfo";
  import {BASICINFO} from "@/const/planning";

  export default {
    name: "registerDetail",
    props: {
      id: null
//        {
//        type: Number,
//        required: true
//      } //成果ID
    },
    data() {
      return {
        registerinfoData: {
          relatedFiles:[],
        },
        BASICINFO: BASICINFO
      }
    },
    created() {
      this.getRegisterinfoData();
    },
    methods: {
      getRegisterinfoData() {
        getRegisterinfo(this.id).then(response => {
          if (response.data.code == 0) {
            this.registerinfoData = response.data.data;
            if(this.registerinfoData.fileId!=''&&this.registerinfoData.fileId!=null){
              this.registerinfoData.relatedFiles = this.registerinfoData.fileId.split(',')
            }
          }
        });
      }
    }
  };
</script>
